﻿using System;
using Locator.Admin.Views;
using Microsoft.Practices.ObjectBuilder;

namespace Locator.Admin.Views
{
    public partial class AdminDefault : Microsoft.Practices.CompositeWeb.Web.UI.Page, IDefaultView
    {
        private DefaultViewPresenter presenter;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.presenter.OnViewInitialized();
            }

            this.presenter.OnViewLoaded();
        }

        [CreateNew]
        public DefaultViewPresenter Presenter
        {
            set
            {
                this.presenter = value;
                this.presenter.View = this;
            }
        }

        public override void Dispose()
        {
            if (this.presenter != null)
            {
                this.presenter.Dispose();
            }

            base.Dispose();
        }
    }
}
